package com.example.demo14streamproducer.controller;

import com.example.demo14streamproducer.msg.ISendService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.integration.support.MessageBuilder;
import org.springframework.messaging.Message;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Created by yawn on 2017-11-06 20:11
 */
@RestController
public class ProducerController {

    @Autowired
    ISendService sendService;

    @GetMapping("/send/{msg}")
    public boolean send(@PathVariable String msg) {
        Message message = MessageBuilder.withPayload(msg.getBytes()).build();
        boolean send = sendService.send().send(message);
        return send;
    }
}
